package com.dt76.smallloanbackendservice.controller.afterloan;


import com.dt76.smallloanbackendservice.pojo.afterloan.InspectionCommitInfo;
import com.dt76.smallloanbackendservice.pojo.afterloan.InspectionSimpleLoanMessage;
import com.dt76.smallloanbackendservice.pojo.afterloan.RepaymentQualification;
import com.dt76.smallloanbackendservice.service.afterloan.InspectionService;
import com.dt76.smallloanbackendservice.utils.PageResult;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
public class InspectionController {

    private final InspectionService inspectionService;

    public InspectionController(InspectionService inspectionService) {
        this.inspectionService = inspectionService;
    }

    @PostMapping("/inspection/getPageList")
    public PageResult getPageList(@RequestBody RepaymentQualification q, Integer page, Integer size) {
        return inspectionService.qryAll(q, page, size);
    }

    @PostMapping("/inspection/simpleLoanInfoSearch")
    public Integer simpleLoanInfoSearch(@RequestBody InspectionCommitInfo commitInfo) {
        return inspectionService.addCommitInfo(commitInfo);
    }

    @RequestMapping("/inspection/getAllSimpleLoanMessage")
    public List<InspectionSimpleLoanMessage> getAllSimpleLoanMessage(){
        return inspectionService.getAllSLM();
    }

    @RequestMapping("/inspection/getTheSimpleLoanMessage")
    public List<InspectionSimpleLoanMessage> getTheSimpleLoanMessage(@RequestBody InspectionCommitInfo info){
        return inspectionService.getTheSLM(info);
    }
}
